package com.soft.service;

import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.Assert;

import com.soft.entity.Dept;
@SpringBootTest
public class DeptServiceTest {
	@Autowired
	private DeptService deptService;
	@Test
	public void queryAllTest() {
		List<Dept> deptList = deptService.queryAll();
		Assert.notEmpty(deptList,"为空");
		Assert.isTrue(deptList.size()>0, "数据有值");
		}
	//@Test
	public void queryByLocTest() {
		List<Dept> deptList = deptService.queryByLoc("北京");
		Assert.isTrue(deptList.size()==1,"根据loc进行查询结果的数据不对");
	}
	//@Test
	public void insertOneTest() {
		int num = deptService.insertOne("事业一部", "秦皇岛");
		Assert.isTrue(num==1, "增加数据错误");
	}
	@Test
	public void deleteByIdTest() {
		int num = deptService.deleteById("1");
		Assert.isTrue(num==1, "删除数据错误");
	}
	@Test
	public void updateOneTest() {
		int num = deptService.updateOne("3","赵部","贵州");
		Assert.isTrue(num==1, "数据修改错误");
	}
}
